package com.winter.Controller;

import com.winter.service.FinancialService;
import com.winter.util.Result;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

import jodd.madvoc.meta.GET;

@RestController
@RequestMapping("v1/financial/data/")
public class FinancialController {

    /**
     * - 金融数据
     */
    @Autowired
    public FinancialService financialService;

    /**
     * 债券估值列表
     */
    @GetMapping("bond")
    public Result bondList(String date, Integer pageSize, Integer pageNumber) {
        return financialService.bondList(date, pageSize, pageNumber);
    }

    /**
     * 债券估值视图
     */
    @GetMapping("bond_view")
    public Result bondView(String beginDate, String endTime, Long[] ids, Integer deadline) {
        return financialService.bondView(beginDate, endTime, ids, deadline);
    }


    /**
     * shibor报价列表
     */
    @GetMapping("shibor")
    public Result shiborList(String date, Integer pageSize, Integer pageNumber) {
        return financialService.shiborList(date, pageSize, pageNumber);
    }

    /**
     * shibor报价视图
     */
    @GetMapping("shibor_view")
    public Result shiborView(String[] deadline, String date) {
        return financialService.shiborList(deadline, date);
    }

    /**
     * 新债发行
     */
    @GetMapping("new_issue")
    public Result newIssueList(String classId, String way, String rate, String date, Integer pageSize, Integer pageNumber, String key) {
        return financialService.newIssueList(classId, way, rate, date, pageSize, pageNumber, key);
    }

    /**
     * 历史发行
     */
    @GetMapping("history_issue")
    public Result historyIssue(String classId, String way, String rate, String date, Integer pageSize, Integer pageNumber, String keyword) {
        return financialService.historyIssue(classId, way, rate, date, pageSize, pageNumber,keyword);
    }


    /**
     * 发行文件
     */
    @GetMapping("issue_file")
    public Result issueFileList(String rateId, String userId) {
        return financialService.issueFileList(rateId, userId);
    }

    /**
     * 票据报价
     */
    @GetMapping("fares_quote")
    public Result faresQuote(Integer pageSize, Integer pageNumber, String date) {
        return financialService.faresQuote(pageSize, pageNumber, date);
    }

    @GetMapping("fares_quote_view")
    public Result faresQuoteView(String beginDate, String endTime, String[] deadline, String date) {
        return financialService.faresQuoteView(beginDate, endTime, deadline, date);
    }

    /**
     * 评级变动
     */
    @GetMapping("rating_change")
    public Result ratingChange(Integer pageSize, Integer pageNumber, String change, String zhaiXiang, String zhuTi, String type, String date, String key) {
        return financialService.ratingChange(pageSize, pageNumber, change, zhaiXiang, zhuTi, type, date, key);
    }

    /**
     * 评级变动详情
     */
    @GetMapping("rating_change_detail")
    public Result ratingChangeDetail(Long userId, String issCredCode, String bondCode, String type) {
        return financialService.ratingChangeDetail(userId, issCredCode, bondCode, type);
    }
}

